class WidgetDatasController < ApplicationController
  # GET /widget_datas
  # GET /widget_datas.xml
  def index
    @widget_datas = WidgetData.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @widget_datas }
    end
  end

  # GET /widget_datas/1
  # GET /widget_datas/1.xml
  def show
    @widget_data = WidgetData.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @widget_data }
    end
  end

  # GET /widget_datas/new
  # GET /widget_datas/new.xml
  def new
    @widget_data = WidgetData.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @widget_data }
    end
  end

  # GET /widget_datas/1/edit
  def edit
    @widget_data = WidgetData.find(params[:id])
  end

  # POST /widget_datas
  # POST /widget_datas.xml
  def create
    @widget_data = WidgetData.new(params[:widget_data])

    respond_to do |format|
      if @widget_data.save
        flash[:notice] = 'WidgetData was successfully created.'
        format.html { redirect_to(@widget_data) }
        format.xml  { render :xml => @widget_data, :status => :created, :location => @widget_data }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @widget_data.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /widget_datas/1
  # PUT /widget_datas/1.xml
  def update
    @widget_data = WidgetData.find(params[:id])

    respond_to do |format|
      if @widget_data.update_attributes(params[:widget_data])
        flash[:notice] = 'WidgetData was successfully updated.'
        format.html { redirect_to(@widget_data) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @widget_data.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /widget_datas/1
  # DELETE /widget_datas/1.xml
  def destroy
    @widget_data = WidgetData.find(params[:id])
    @widget_data.destroy

    respond_to do |format|
      format.html { redirect_to(widget_datas_url) }
      format.xml  { head :ok }
    end
  end
end
